package com.springboot.autoconfigure.oss.config;

import com.springboot.autoconfigure.oss.annontion.RequiredFiled;
import com.springboot.autoconfigure.oss.service.impl.AliyunOssApiServiceImpl;
import com.springboot.autoconfigure.oss.service.impl.JdOssApiServiceImpl;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Data
@Accessors(chain = true)
@Configuration
@ConfigurationProperties(prefix = "oss.jd")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class JdOSSPropertis extends AbstractOSSPropertis {
    /**
     * 各地域Endpoint的内外网配置如下：
     *
     * Region中文名称	Region英文表示	外网Endpoint	内网Endpoint	IPv6 Endpoint	支持 HTTPS
     * 华北-北京	cn-north-1	s3.cn-north-1.jdcloud-oss.com	s3-internal.cn-north-1.jdcloud-oss.com	s3-ipv6.cn-north-1.jdcloud-oss.com	是
     * 华南-广州	cn-south-1	s3.cn-south-1.jdcloud-oss.com	s3-internal.cn-south-1.jdcloud-oss.com	暂不支持IPv6	是
     * 华东-上海	cn-east-2	s3.cn-east-2.jdcloud-oss.com	s3-internal.cn-east-2.jdcloud-oss.com	暂不支持IPv6	是
     * 华东-宿迁	cn-east-1	s3.cn-east-1.jdcloud-oss.com	s3-internal.cn-east-1.jdcloud-oss.com	s3-ipv6.cn-east-1.jdcloud-oss.com	是
     */
    @RequiredFiled
    private String region;
    @RequiredFiled
    private String accessKey;
    @RequiredFiled
    private String secretkey;
    @RequiredFiled
    private String bucketName;

    /**
     * url访问地址前缀 通常是 https://<bucketName>.s3.<region>.jdcloud-oss.com/  最后有斜杠！！！！！！！！！！！！！！
     */
    @RequiredFiled
    private String domain;

    @Override
    public Class getImpl() {
        return JdOssApiServiceImpl.class;
    }
}
